Home |
| Latest | About | Random
# 09 Entrywise formulas for basic matrix operations. Now that you have familiarized yourself with the basic matrix operations (addition, multiplication, scaling, and transpose), we can write down their precise mathematical formulations in terms of the entries of the matrices. ## Entries in a matrix and notation. Let us recall our common convention. For an $n\times k$ matrix $A$, it has $n$ many rows (so the height of the matrix of $A$ is $n$) and $k$ many columns (so the width of the matrix is $k$). We start indexing from the top-left corner of the matrix like so $$ A = \begin{bmatrix} a_{11} & a_{12} & a_{13} & \cdots & a_{1k} \\ a_{21} & a_{22} & a_{23} & \cdots & a_{2k} \\ a_{31} & a_{32} & a_{33} & \cdots & a_{3k} \\ \vdots & & & & \vdots\\ a_{n1} & a_{n2} & a_{n3} & \cdots & a_{nk} \end{bmatrix} $$where the $(i,j)$-th entry of $A$ is denoted as $a_{ij}$ to represent the $i$-th row, $j$-th column entry, in that order. If the indices are all single digit, then $a_{ij}$ suffices, but if there are multiple digits that may cause confusion, then write $a_{i,j}$ instead. Sometimes if the name of the entry is not specified, but rather we just have the name of the matrix $A$, we may also write $A[i,j]$ or $A_{i,j}$ or $[A]_{ij}$ or $(A)_{ij}$ to denote the $(i,j)$-th entry of the matrix $A$. Again, $(i,j)$-th entry of a matrix is the $i$-th row, $j$-th column entry of $A$. This is the convention we adopt. Formulas henceforth follow this convention. Sometimes to denote $A$ has entries described by $a_{ij}$, we write $A=[a_{ij}]$ or $A=[a_{ij}]_{\substack{0\le i\le n \\ 0\le j \le k}}$ to denote the range of these indices. ## Scaling of a matrix. Suppose we have an $n\times k$ matrix $A$, and a scalar $c$, then we have $$ (cA)_{ij} = c(A)_{ij}. $$ This says the $(i,j)$-th entry of $cA$ is $c$ times the $(i,j)$-th entry of $A$. This is straightforward but it is good to get comfortable reading these notations. ## Sum of matrices. Suppose we have $A$ and $B$ both of the same size $n\times k$, then we have $$ (A+B)_{ij}=(A)_{ij} + (B)_{ij}. $$ This says the $(i,j)$-th entry of $A+B$ is the sum of the $(i,j)$-th entry of $A$, and the $(i,j)$-th entry of $B$. This gives an entrywise description of how addition of matrices work. ## Transpose of a matrix. Suppose we have an $n\times k$ matrix $A$, then we recall its transpose $A^{T}$ is a $k\times n$ matrix where the $i$-th row of $A$ becomes the $i$-th column of $A^{T}$. Here is how we describe it entrywise: $$ (A^{T})_{ij} = (A)_{ji} $$Take a moment to think about this. This is saying the $(i,j)$-th entry of $A^{T}$ is the same as the $(j,i)$-th entry of $A$. This effectively says the rows of one becomes the columns of the other, and vice versa! ## Matrix product -- the row-column rule. Recall that when we have two matrices $A,B$, their product is only defined if their "inner sizes" match up. So let us take $A$ to be $n\times k$ and matrix $B$ to be $k\times p$, where $A$ has $k$ columns and $B$ has $k$ rows. Then the product $AB$ is defined, and it is an $n\times p$ matrix. Now for matrix $A$ of size $n\times k$ and matrix $B$ of size $k\times p$, the $(i,j)$-th entry of $AB$ is given by: > ** The row-column rule of matrix product.** > $$ \begin{array}{ccl} (AB)_{ij} &= & \displaystyle\sum_{t=1}^{k}(A)_{it}(B)_{tj} \\ & = & (A)_{i1}(B)_{1j} + (A)_{i2}(B)_{2j} + (A)_{i3}(B)_{3j} + \cdots + (A)_{ik}(B)_{kj} \ \ . \end{array} $$ for each $0\le i \le n$ and each $0 \le j \le p$. Let us make sense of this. This is saying the $(i,j)$-th entry of $AB$ is by taking the entries along the $i$-th row of $A$, and the entries along the $j$-th column of $B$, and we go down one by one, indexed by $t$, take their corresponding product and add them together:$$ \begin{bmatrix} & & \vdots \\ & & \vdots & \\ (A)_{i{\color{blue}1}} & (A)_{i{\color{blue}2}} & (A)_{i{\color{blue}3}} & \cdots & (A)_{i{\color{blue}k}} \\ & & \vdots & \\ & &\vdots & \end{bmatrix} \begin{bmatrix} & & (B)_{{\color{blue}1}j} & & \\ & & (B)_{{\color{blue}2}j} \\ \cdots & \cdots & (B)_{{\color{blue}3}j} & \cdots & \cdots\\ & & \vdots \\ & & (B)_{{\color{blue}k}j} \end{bmatrix} = \begin{bmatrix} & \vdots \\ & \vdots \\ \cdots & \displaystyle \sum_{\color{blue}t=1}^{\color{blue}k}(A)_{i{\color{blue}t}}(B)_{{\color{blue}t}j} & \cdots \\ & \vdots \\ & \vdots \end{bmatrix} $$Note well when we are calculating the $(i,j)$-th entry of $AB$, it is a sum of products where the running index is the "inner index", while matrix $A$ fixes the row index $i$, and the matrix $B$ fixes the the column index $j$. Whew! This takes a while to digest. But once you do, it is useful in various contexts: (1) If you want to actually **encode** this into a computer, this tells you how the entries work, (2) when we want to **prove** statements about matrices involving these operations, and (3) when you want to give precise **formulas** of things besides just "giving a general description", like how we have for matrix product previously. Now, pragmatically, when you multiply matrices by hand, you don't need to process the indices consciously, but this formula is happening in the background!